package ${packageName}.action;
// Generated ${date} by Extras Tools ${version}

<#assign classbody>
<#assign declarationName = pojo.importType(pojo.getDeclarationName())>
<#assign serviceName = pojo.importType("${pojo.packageName}.${declarationName}Service")>
<#assign modelName = declarationName?lower_case>
import ${pojo.getQualifiedDeclarationName()};
import ${packageName}.service.${declarationName}Service;
/**
 * Service implementation class for model ${declarationName}.
 * @see ${pojo.getQualifiedDeclarationName()}
 * @author Extras Tools
 */
 @${pojo.importType("org.apache.struts2.convention.annotation.Results")}(value = {
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(type = "redirectAction", location = "${modelName}-list"),
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(name = ${pojo.importType("com.xcesys.extras.webapp.action.BaseAction")}.LIST, type = "redirectAction", location = "${modelName}-list"),
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(name = ${pojo.importType("com.xcesys.extras.webapp.action.BaseAction")}.CANCEL, type = "redirectAction", location = "${modelName}-list"),
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(name = BaseCrudAction.ADD, type = "redirectAction", location = "${modelName}-add"),
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(name = BaseCrudAction.EDIT, type = "redirectAction", location = "${modelName}-edit", params = {
				"id", "${r'${id}'}" }),
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(name = ${pojo.importType("com.xcesys.extras.webapp.action.BaseAction")}.INPUT, location = "${modelName}/${modelName}_input.jsp"),
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(name = ${pojo.importType("com.xcesys.extras.webapp.action.BaseAction")}.VIEW, location = "${modelName}/${modelName}_input.jsp"),
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(name = ${pojo.importType("com.xcesys.extras.webapp.action.BaseAction")}.ERROR, type = "chain", location = "${modelName}-list"),
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(name = ${pojo.importType("com.xcesys.extras.webapp.action.BaseAction")}.CHECKERROR, type = "chain", location = "${modelName}-list"),
		@${pojo.importType("org.apache.struts2.convention.annotation.Result")}(name = ${pojo.importType("com.xcesys.extras.webapp.action.BaseAction")}.INVALID_TOKEN, location = "${modelName}/${modelName}_input.jsp") })
public class ${declarationName}Action extends ${pojo.importType("com.xcesys.extras.webapp.action.BaseCrudAction")}<${declarationName}> {
	
	private ${declarationName} ${modelName};

	@${pojo.importType("org.springframework.beans.factory.annotation.Autowired")}
	private ${pojo.importType("${pojo.packageName}.${declarationName}Service")} service;
	
	@${pojo.importType("java.lang.Override")}
	public ${pojo.importType("com.xcesys.extras.core.service.ICrudService")}<${declarationName}> getService() {
		return service;
	}

	@${pojo.importType("java.lang.Override")}
	protected ${declarationName} newModel() {
		return new ${declarationName}();
	}

	public ${declarationName} get${modelName?capitalize}() {
		this.${modelName} = getModel();
		return this.${modelName};
	}

	public void set${modelName?capitalize}(${declarationName} ${modelName}) {
		this.${modelName} = ${modelName};
		setModel(this.${modelName});
	}
	
	@${pojo.importType("java.lang.Override")}
	public String getModelName() {
		return getText("${modelName}.modelName");
	}

	@${pojo.importType("java.lang.Override")}
	protected void prepareQueryCriteria(${pojo.importType("com.xcesys.extras.core.model.QueryCriteria")}<String, Object> query) {
	}
	
	/**
	 * Quick search action.
	 * 
	 * @return
	 */
	@${pojo.importType("org.apache.struts2.interceptor.validation.SkipValidation")}
	@${pojo.importType("org.apache.struts2.convention.annotation.Action")}(value = "${modelName}-qsearch")
	public String qsearch() {
		return super.qsearch();
	}
	
}
</#assign>
${pojo.generateImports()}
${classbody}